package core;

import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.util.Queue;

import util.ResourceManager;

/**
 * Represents a state of the game. <br>
 * Some example types of states you may have are: <br>
 * <br>
 * SplashScreenState<br>
 * GameLobbyState<br>
 * LoadingState<br>
 * GamePlayState <br>
 * EndGameReportState
 * 
 * @author Jason
 * 
 */
public interface GameState {

	/**
	 * Loads all needed resources for this state.
	 */
	public void loadResources(ResourceManager resourceManager);

	/**
	 * Signals the beginning of this GameState. Appropriate key bindings should
	 * be set now.
	 */
	public void start(InputManager inputManager);

	/**
	 * Ends this state, de-allocating resources, and stopping any additional
	 * threads.
	 */
	public void stop();

	/**
	 * Renders this state to the screen.
	 */
	public void render(Graphics2D g, int screenWidth, int screenHeight);

	/**
	 * Updates this state.
	 * 
	 * @param elapsedMillis
	 *            The amount of time that has passed since the last update.
	 */
	public void update(int elapsedMillis);

	/**
	 * Handle all of the mouse events which were generated by the user since the
	 * last update.
	 */
	public void handle(Queue<MouseEvent> mouseInput);

	/**
	 * Initializes this entity with any needed resources such as images.
	 * 
	 * This method is also responsible for adding the entity to the scene.
	 * 
	 * @param e
	 *            The new entity.
	 */
	public void handleNewEntity(Entity e);

	/**
	 * Returns the name of the next state
	 * 
	 * @return NULL if this state is still active.
	 */
	public String getNextState();

	/**
	 * The unique name of this game state.
	 */
	public String getName();

}
